import React from 'react';
import { Modal } from 'antd';
import { history } from 'umi';

type ModalPropsType = Record<string, any>;

const ModalResult: React.FC<ModalPropsType> = (props) => {
  const { changeIsModalOpen, isopen } = props;

  const handleOk = () => {
    changeIsModalOpen(false);
    history.push('/login');
  };

  const handleCancel = () => {
    changeIsModalOpen(false);
  };

  return (
    <>
      <Modal title="注册结果" open={isopen} onOk={handleOk} onCancel={handleCancel}>
        <p>恭喜您注册成功，请不要清理本地缓存，否则需要重新注册哦~</p>
      </Modal>
    </>
  );
};

export default ModalResult;
